// written by Ray Zeller

#include "Processor.h"
#include <sstream>
using namespace std;

Processor::Processor()
{
}

Processor::Processor(const vector<Event*>& events)
: myEvents(events)
{
}
vector<vector<string> > Processor:: process(){
	vector<vector<string> > finalResult;
	currentDay =  myEvents[0]->getDay();
	vector <Event*> collectDay;
	
	myDays.push_back(myEvents[0]->printDay());
	int i = 0;
	for (vector<Event*>::iterator it = myEvents.begin(); it!=myEvents.end(); ++it) {
		if((*it)->Event::getDay() != currentDay){
			Day d = Day(collectDay, false);
			finalResult.push_back(d.dayList());
			collectDay.clear();
			currentDay=(*it)->Event::getDay();
			myDays.push_back((*it)->Event::printDay());
		}
		collectDay.push_back(myEvents[i]);
		i++;
	}
	Day d = Day(collectDay, false);
	finalResult.push_back(d.dayList());
	return finalResult;
}
Processor::~Processor()
{
}